package com.itheima.app.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.itheima.app.service.AppointmentService;
import com.itheima.health.model.entry.Result;
import com.itheima.health.model.pojos.ReservationInformation;
import com.itheima.health.model.pojos.submitOrderDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
//@RequestMapping("/setmeal")
public class AppointmentController {

    @Autowired
    private AppointmentService appointmentService;

    @PostMapping("/validateCode/send4Order")
    public Result validateCode( String telephone){
      return  Result.success();
    }

    @PostMapping("/order/submit")
    public Result submitOrder(@RequestBody submitOrderDTO orderDTO) {

        Result id =  appointmentService.submitOrder(orderDTO);
        return id;
    }

    @PostMapping("/order/findById")
    public Result findById( Integer id) {
        ReservationInformation build = appointmentService.findById(id);
        return Result.success(build);
    }


}
